package com.training.java.core.collections.car.post15;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.training.java.core.collections.car.pre15.CellPhone;
import com.training.java.core.collections.car.pre15.LapTop;

/**
 * Created multiple objects and adding them to List( generic code) List accepts
 * duplicate values. List accepts nulls Maintains the order
 * 
 * @author Satya
 */
public class LapTopListDemo {

	public static void main(String[] args) {

		{

			LapTop laptop1 = new LapTop("IBM", "lenove", "intel core",
					"Windows 32");
			LapTop laptop2 = new LapTop("Dell", "inspiron", "Quad core",
					"Windows 64");
			LapTop laptop3 = new LapTop("Acer", "aspire", "Dual core", "Linux");
			LapTop laptop4 = new LapTop();
			// Same object with different Object Name
			LapTop laptop5 = new LapTop("Acer", "aspire", "Dual core", "Linux");

			// instantiating

			List<LapTop> listOfLapTops = new ArrayList<LapTop>();
			// adding the objects to the list

			listOfLapTops.add(laptop1);
			listOfLapTops.add(laptop2);
			listOfLapTops.add(laptop3);
			// listOfLapTops.add(null);//adding null
			listOfLapTops.add(laptop4);
			listOfLapTops.add(laptop5);// Same object with different Object Name
			listOfLapTops.add(laptop2);// adding duplicate

			// Iterator

			for (LapTop laptop : listOfLapTops) {

				System.out.println(" laptop  Company : " + laptop.getCompany());
				System.out.println(" laptop   Model : " + laptop.getModel());

				System.out.println(" laptop  Price  : " + laptop.getOs());
				System.out.println("************************");

			}

		}

	}
}
